package jwdt.xadmin.rskq.service.impl;

import jwdt.common.dao.BaseDao;
import jwdt.xadmin.custom.bean.TCustom;
import jwdt.xadmin.rskq.bean.TRsxx;
import jwdt.xadmin.rskq.service.RsxxManageService;

import com.ezerg.db.ext.PageUtil;
import com.ezerg.util.StringUtil;

public class RsxxManageServiceImpl implements RsxxManageService {

	private BaseDao<TRsxx> baseDao;
	
	public void setBaseDao(BaseDao<TRsxx> baseDao) {
		this.baseDao = baseDao;
	}
	
	@Override
	public PageUtil doList(PageUtil pu, TRsxx tc ,int userid) throws Exception{
		String where = "";
		String fullname = tc.getFullname();
		if(!StringUtil.nullOrBlank(fullname)) {
			where += " fullname like '%" + fullname + "%'";
		}
		String sql = " order by id desc";
		pu.doList(TRsxx.class,where+sql);
		//创造json数据对象
		return pu;
	}
	
	@Override
	public PageUtil doList(PageUtil pu, TRsxx tc) throws Exception{
		String where = "";
		String fullname = tc.getFullname();
		if(!StringUtil.nullOrBlank(fullname)) {
			where += " fullname like '%" + fullname + "%'";
		}
		String sql = " order by id desc";
		pu.doList(TRsxx.class,where+sql);
		//创造json数据对象
		return pu;
	}
	@Override
	public String doAddact(TRsxx obj) throws Exception {
		
		String ret = baseDao.doAddObj(obj);
		return ret;
	}

	@Override
	public String doEditact(TRsxx obj, int id) throws Exception {
		String ret = baseDao.doUpdateObj(TRsxx.class, id, obj);
		
		
		return ret;
	};
	
	@Override
	public String doDelact(int id) throws Exception {
		TCustom.deleteCascade(id);
		return baseDao.doDelObj(TRsxx.class, id);
	}

	@Override
	public TRsxx doLoad(int id) throws Exception {
		return baseDao.doLoadObj(TRsxx.class, id);
	}
}
